﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Sql_c
{
    class UserInfoDal
    {
        //注册
        public bool Register(string userName,string userAccount,string userPwd)
        {
            string scomm = "insert into userInfo values ('"+userName+"','"+userAccount+"','"+userPwd+"')";
            int t = new DBHelper().ExecNonQuery(scomm);
            return t > 0;
        }

        //根据编号删除
        public bool DeleteById(int i)
        {
            string scomm = "delete from userInfo where id ="+i;
            int t = new DBHelper().ExecNonQuery(scomm);
            return t > 0;
        }

        //改密码
        public bool ChangePwdById(string newPwd,int i)
        {
            string scomm = "update userInfo set pwd = '"+newPwd+"' where id = "+i+"";
            int t = new DBHelper().ExecNonQuery(scomm);
            return t > 0;
        }

        //更新

        //根据性别查询
        public DataTable ReferBySex(string sex)
        {
            string scmd = "select * from userInfo where userSex = '"+sex+"'";
            return new DBHelper().ExecQuery(scmd);
        }

        //根据商品类别和商品及格区间查询商品

            
    }
}
